package com.k2


import org.apache.spark.sql.SparkSession

/**
 * @Author taiyn
 * @Description TODO
 * @Date 9:36 PM 2023/9/28
 * */
object SimpleApp {
  def main(args: Array[String]): Unit = {
    val logFile = "/Users/serpmelon/IdeaProjects/my_movie_recommend/test.log" // Should be some file on your system
    val spark = SparkSession.builder.appName("Simple Application")
      .master("local")
      .getOrCreate()
    val logData = spark.read.textFile(logFile).cache()
    val numAs = logData.filter(line => line.contains("a")).count()
    val numBs = logData.filter(line => line.contains("b")).count()
    println(s"Lines with a: $numAs, Lines with b: $numBs")
    spark.stop()
  }
}
